﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="BlocksStyleColored.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BlocksStyleColored"
    xmlns:common="using:BlocksStyleColored.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <UserControl.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>

        <CollectionViewSource
        	x:Name="groupedItemsViewSource"
        	Source="{Binding Groups}"
        	IsSourceGrouped="true"
        	ItemsPath="Items"
            d:Source="{Binding ItemGroups}"
            />

        <Style x:Key="GridViewStyle1" TargetType="GridView">
            <Setter Property="Padding" Value="0,0,0,10"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="TabNavigation" Value="Once"/>
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
            <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled"/>
            <Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled"/>
            <Setter Property="ScrollViewer.ZoomMode" Value="Disabled"/>
            <Setter Property="IsSwipeEnabled" Value="True"/>
            <Setter Property="ItemContainerTransitions">
                <Setter.Value>
                    <TransitionCollection>
                        <AddDeleteThemeTransition/>
                        <ContentThemeTransition/>
                        <ReorderThemeTransition/>
                        <EntranceThemeTransition IsStaggeringEnabled="False"/>
                    </TransitionCollection>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <WrapGrid Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="GridView">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                            <ScrollViewer x:Name="ScrollViewer" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" TabNavigation="{TemplateBinding TabNavigation}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
                                <StackPanel Height="100" Width="100">
                                    <Image Height="100" Source="Images/HubImage2.png" Stretch="Fill"/>
                                </StackPanel>
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
    </UserControl.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Image Margin="0" Source="Assets/et-background.png" Stretch="Fill" Grid.RowSpan="2"/>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="Your App Slogan / Logo Goes Here" Style="{StaticResource PageHeaderTextStyle}"/>
        </Grid>
        <ScrollViewer
        	x:Name="itemGridScrollViewer"
        	AutomationProperties.AutomationId="ItemGridScrollViewer"
        	Margin="0"
        	Style="{StaticResource HorizontalScrollViewerStyle}" Grid.Row="1" HorizontalScrollBarVisibility="Visible">
            <StackPanel Orientation="Horizontal" Width="1246" Margin="120,30,0,0" HorizontalAlignment="Left">
                <StackPanel Orientation="Vertical">
                    <StackPanel Margin="0" Orientation="Horizontal">
                        <GridViewItem x:Name="Adventure_" Margin="0" Width="216" HorizontalAlignment="Left">
                            <Grid HorizontalAlignment="Left" Height="316" Width="208" Tapped="Grid_Tapped_1">
                                <Rectangle Fill="#D8F7941E" VerticalAlignment="Bottom" Height="316" Width="208"/>
                                <Grid VerticalAlignment="Bottom">
                                    <Rectangle Fill="#D8F7941E" VerticalAlignment="Bottom" Height="45"/>
                                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 1" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                                </Grid>
                            </Grid>
                        </GridViewItem>
                        <GridViewItem x:Name="Literature" Margin="0" Width="216" HorizontalAlignment="Left" Tapped="Grid_Tapped_1">
                            <Grid HorizontalAlignment="Left" Height="316" Width="208" Tapped="Grid_Tapped_1">
                                <Rectangle Fill="#D800AEEF" VerticalAlignment="Bottom" Height="316" Width="208" />
                                <Grid VerticalAlignment="Bottom">
                                    <Rectangle Fill="#D800AEEF" VerticalAlignment="Bottom" Height="45"/>
                                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 2" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                                </Grid>
                            </Grid>
                        </GridViewItem>
                        <GridViewItem x:Name="Landscapes" Margin="0" Width="510" HorizontalAlignment="Left" Tapped="Grid_Tapped_1">
                            <Grid HorizontalAlignment="Left" Height="316">
                                <Rectangle Fill="#D8D7DF23" VerticalAlignment="Bottom" Height="316" Width="510"/>
                                <Grid VerticalAlignment="Bottom">
                                    <Rectangle Fill="#D8D7DF23" VerticalAlignment="Bottom" Height="45"/>
                                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 3" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                                </Grid>
                            </Grid>
                        </GridViewItem>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <GridViewItem x:Name="Cinema" Margin="0" Width="432" HorizontalAlignment="Left" Height="166" Tapped="Grid_Tapped_1">
                            <Grid HorizontalAlignment="Left">
                                <Rectangle Fill="#D8F26522" VerticalAlignment="Bottom" Width="432" Height="166"/>
                                <Grid VerticalAlignment="Bottom">
                                    <Rectangle Fill="#D8F26522" VerticalAlignment="Bottom" Height="45"/>
                                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 4" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                                </Grid>
                            </Grid>
                        </GridViewItem>
                        <GridViewItem x:Name="RuralSports" Margin="0" Width="255" HorizontalAlignment="Left" Height="166" Tapped="Grid_Tapped_1">
                            <Grid HorizontalAlignment="Left">
                                <Rectangle Fill="#D8231F20" VerticalAlignment="Bottom" Width="255" Height="166"/>
                                <Grid VerticalAlignment="Bottom">
                                    <Rectangle Fill="#D8231F20" VerticalAlignment="Bottom" Height="45"/>
                                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 5" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                                </Grid>
                            </Grid>
                        </GridViewItem>
                        <GridViewItem x:Name="WildLife" Margin="0" Width="255" HorizontalAlignment="Left" Height="166" Tapped="Grid_Tapped_1">
                            <Grid HorizontalAlignment="Left">
                                <Rectangle Fill="#D8006838" VerticalAlignment="Bottom" Width="255" Height="166"/>
                                <Grid VerticalAlignment="Bottom">
                                    <Rectangle Fill="#D8006838" VerticalAlignment="Bottom" Height="45"/>
                                    <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 6" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                                </Grid>
                            </Grid>
                        </GridViewItem>
                    </StackPanel>
                </StackPanel>
                <StackPanel>
                    <GridViewItem x:Name="CostalAreas" Margin="0" Width="280" HorizontalAlignment="Left" Height="170" Tapped="Grid_Tapped_1">
                        <Grid HorizontalAlignment="Left">
                            <Rectangle Fill="#D81C75BC" VerticalAlignment="Bottom" Width="280" Height="170"/>
                            <Grid VerticalAlignment="Bottom">
                                <Rectangle Fill="#D81C75BC" VerticalAlignment="Bottom" Height="45"/>
                                <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 7" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                            </Grid>
                        </Grid>
                    </GridViewItem>
                    <GridViewItem x:Name="People" Margin="0" Width="280" HorizontalAlignment="Left" Height="321" Tapped="Grid_Tapped_1">
                        <Grid HorizontalAlignment="Left">
                            <Rectangle Fill="#D892278F" VerticalAlignment="Bottom" Width="280" Height="321"/>
                            <Grid VerticalAlignment="Bottom">
                                <Rectangle Fill="#D892278F" VerticalAlignment="Bottom" Height="45"/>
                                <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Heading 8" VerticalAlignment="Center" Margin="16.5,0,0,0" FontSize="18.667"/>
                            </Grid>
                        </Grid>
                    </GridViewItem>
                </StackPanel>
            </StackPanel>
        </ScrollViewer>

        <Grid x:Name="gridSnap" Visibility="Collapsed" Grid.Row="1">
            <StackPanel Margin="15,0,20,20" Orientation="Vertical" d:LayoutOverrides="Height">

                <TextBlock Foreground="#ffffff" TextWrapping="Wrap" FontSize="26.667" Margin="0,200,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Light" >
                    <Run Text="Please switch to full screen to view the details."/>
                    <LineBreak/>
                    <Run/>
                    <LineBreak/>
                    <Run Text="" />
                    <LineBreak/>
                    <Run/>
                    <LineBreak/>
                    <LineBreak/>
                    <Run/>
                    <LineBreak/>
                </TextBlock>
            </StackPanel>
            <Image Margin="0,495,0,0" Source="Assets/Images/bg.jpg" Stretch="Fill"/>
        </Grid>
        
        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup>
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridSnap" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridScrollViewer" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
